package util;

import beans.QueryParamInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by yanglq on 2018/4/8.
 */
public class ParamUtil {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    public  QueryParamInfo initConfig() throws IOException {
        QueryParamInfo queryParamInfo = new QueryParamInfo();
        try {
            Properties prop2 = new Properties();
            InputStream in = this.getClass().getResourceAsStream("/info.properties");
            prop2.load(in);
            queryParamInfo.setCarNum(prop2.getProperty("carNum"));
            queryParamInfo.setQueryTimeInterval(prop2.getProperty("queryTimeInterval"));
//            queryParamInfo.setPageSize(prop2.getProperty("pageSize"));
            logger.info("查询参数加载文件加载完成");
        } catch (Exception e) {
            logger.error("查询参数加载文件加载完成加载失败, 请确认文件是否存在");
            e.printStackTrace();
            throw e;
        }
        return queryParamInfo;
    }


}
